﻿Imports BUS
Imports DTO



Public Class MH_DanhSachHocSinhTheoLop

    Private Sub btnDong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDong.Click
        Me.Close()
    End Sub

    Private Sub MH_DanhSachHocSinhTheoLop_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Load danh sách lớp
        Dim ds As New List(Of LopDTO)
        Dim lopBUS As New LopBUS
        ds = lopBUS.LayDanhSach()
        cboLop.DataSource = ds
        cboLop.DisplayMember = ("TenLop")
        cboLop.ValueMember = ("MaLop")
    End Sub

    Private Sub btnLayDS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLayDS.Click
        Dim dsHS As New List(Of HocSinhDTO)
        Dim hsBUS As New HocSinhBUS
        dsHS = hsBUS.LayDanhSachHocSinhTheoLop(cboLop.SelectedValue)

        'Trước khi gán danh sách và gridview phải clear trước
        dgvDanhSach.Rows.Clear()
        For i As Integer = 0 To dsHS.Count - 1
            dgvDanhSach.Rows.Add(i + 1, dsHS(i).HoTen, dsHS(i).GioiTinh, dsHS(i).NgaySinh, dsHS(i).DiaChi)
        Next

        'Sĩ số
        txtSiSo.Text = dsHS.Count

    End Sub
End Class